//
//  CellForReMen.m
//  SeeTheWorld
//
//  Created by dllo on 16/1/28.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "CellForReMen.h"
#import "PCH.pch"
#import "ModelOfReMen.h"
#import <UIImageView+WebCache.h>


@interface CellForReMen ()

@property (nonatomic, retain)UIImageView *imageViewOfLeft;
@property (nonatomic, retain)UILabel *labelOfTitle;
@property (nonatomic, retain)UILabel *labelOfName;
@property (nonatomic, retain)UILabel *labelOfViews;
@property (nonatomic, retain)UILabel *labelOfReplys;
@property (nonatomic, retain)UIImageView *imageViewOfViews;
@property (nonatomic, retain)UIImageView *imageViewOfReplys;

@end

@implementation CellForReMen

- (void)dealloc {
    [_imageViewOfLeft release];
    [_imageViewOfReplys release];
    [_imageViewOfViews release];
    [_labelOfName release];
    [_labelOfReplys release];
    [_labelOfTitle release];
    [_labelOfViews release];
    [super dealloc];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.imageViewOfLeft = [[UIImageView alloc] init];
        [self.contentView addSubview:self.imageViewOfLeft];
        [_imageViewOfLeft release];
        
        self.imageViewOfReplys = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"PingLun1"]];
        [self.contentView addSubview:self.imageViewOfReplys];
        [_imageViewOfReplys release];
        
        self.imageViewOfViews = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"YanJing1"]];
        [self.contentView addSubview:self.imageViewOfViews];
        [_imageViewOfViews release];
        
        self.labelOfName = [[UILabel alloc] init];
        [self.contentView addSubview:self.labelOfName];
        [_labelOfName release];
        self.labelOfName.textColor = [UIColor lightGrayColor];
        self.labelOfName.dk_textColorPicker = DKColorWithRGB(0x343434, 0xffffff);

        self.labelOfReplys = [[UILabel alloc] init];
        [self.contentView addSubview:self.labelOfReplys];
        [_labelOfReplys release];
        self.labelOfReplys.textColor = [UIColor lightGrayColor];
        self.labelOfReplys.font = [UIFont systemFontOfSize:14];
        self.labelOfReplys.dk_textColorPicker = DKColorWithRGB(0x343434, 0xffffff);

        self.labelOfTitle = [[UILabel alloc] init];
        [self.contentView addSubview:self.labelOfTitle];
        [_labelOfTitle release];
        self.labelOfTitle.numberOfLines = 2;
        self.labelOfTitle.font = [UIFont fontWithName:@"TimesNewRomanPS-ItalicMT" size:17];
        self.labelOfTitle.dk_textColorPicker = DKColorWithRGB(0x343434, 0xffffff);
        
        self.labelOfViews = [[UILabel alloc] init];
        [self.contentView addSubview:self.labelOfViews];
        [_labelOfViews release];
        self.labelOfViews.textColor = [UIColor lightGrayColor];
        self.labelOfViews.font = [UIFont systemFontOfSize:14];
        self.labelOfViews.dk_textColorPicker = DKColorWithRGB(0x343434, 0xffffff);

    }
    return self;
}

- (void)layoutSubviews {
    [super layoutSubviews];
    
    self.imageViewOfLeft.frame = CGRectMake(8, 8, scWIDTH / 3, scHEIGHT - 16);
    self.labelOfTitle.frame = CGRectMake(8 + self.imageViewOfLeft.frame.size.width + 5, 8, scWIDTH / 3 * 2 - 20, 48);
    self.labelOfName.frame = CGRectMake(8 + self.imageViewOfLeft.frame.size.width + 5, 8 + 48 + 5, scWIDTH / 3 * 2 - 20, 28);
    self.imageViewOfViews.frame = CGRectMake(8 + self.imageViewOfLeft.frame.size.width + 5, 8 + 48 + 5 + 28 + 5, 20, 20);
    self.labelOfViews.frame = CGRectMake(self.imageViewOfLeft.frame.size.width + 38, 94, 50, 20);
    self.imageViewOfReplys.frame = CGRectMake(self.imageViewOfLeft.frame.size.width + 38 + 60, 94, 20, 20);
    self.labelOfReplys.frame = CGRectMake(self.imageViewOfLeft.frame.size.width + 38 + 60 + 25, 94, 50, 20);
    
}

- (void)passModel:(ModelOfReMen *)model {
    
    [self.imageViewOfLeft sd_setImageWithURL:[NSURL URLWithString:model.photo] placeholderImage:[UIImage imageNamed:@"1f178a82b9014a90e9109296ad773912b31beeeb"]];
    
    NSString *str = [NSString stringWithFormat:@"%@", model.views];
    NSString *str1 = [NSString stringWithFormat:@"%@", model.replys];
    
    self.labelOfTitle.text = model.title;
    self.labelOfName.text = model.username;
    self.labelOfViews.text = str;
    self.labelOfReplys.text = str1;
    
    
    
}





















@end
